Welcome Login
Blog Photos Links

RSS Feed

Getting a ServiceNow instance URL

August 30, 2018, 2:06 pm - James Farrer

In the London release, ServiceNow is introducing support for custom domain names. What this means is that anywhere a full URL is generated (usually notifications) we'd need to make sure that we're making the URL's properly. I've most often seen and used the instance_name property to get the hostname and then added that in with ".service-now.com". The new feature should be backwards compatible so things won't break but it won't use the new domain should they start using that.

Moving forward we should instead use the following to get the full domain name and then we just need to add the specific path after it.

Use this:

gs.getProperty("glide.servlet.uri")

To get this:

https://crossfuze.service-now.com/

Which in London release could be configured as https://servicenow.crossfuze.com/ or whatever else we want.

Table Name field type and scoped applications

April 30, 2018, 8:47 am - James Farrer

I've run into an issue several times lately and wanted to make a note for myself and thought I'd share it at the same time since it wasn't easy to find in the documentation.

When using a Table Name field on a scoped table there is a restriction by default that only allows tables from the applications scope to be selected in the field. Every time I've used this type of field I've needed to show other tables, particularly Task tables.

The fix is a simple, though obscure, attribute that can be added to the field. 

To fix it:

  1. Go to the dictionary record of the Table Name field with the issue.
  2. Add a new attribute using one of the two main methods:
    1. Using the Attributes related list
      1. Click the New button in the Attributes related list.
      2. Select the "Allow public" attribute.
      3.  Set the value to true.
    2. Using the Attributes field in the Advanced View
      1. Add the following to attributes string with commas to separate the attributes if there are others present:

        allow_public=true

For the field I was working on I had the following to show all Task tables while excluding Task itself:

allow_public=true,​base_table=task,​skip_root=true,​base_start=true

Identify workflows where a group is listed

January 17, 2018, 4:43 pm - James Farrer

 Here's a script that goes through the workflow activity fields and prints out where the group is listed in workflows.

// Sys ID of the group that we're testing for
var group_id = "c4762f920fd0310066e76ab8b1050e58";

var group_gr = new GlideRecord("sys_user_group");
if (group_gr.get(group_id)) {
	gs.print("Querying workflows for group: " + group_gr.getDisplayValue());
}
var wf_var_value_gr = new GlideRecord("sys_variable_value");
wf_var_value_gr.addQuery("value", group_id);
wf_var_value_gr.query();
while (wf_var_value_gr.next()) {
	// Query for the workflow activity
	var wf_activity_gr = new GlideRecord(wf_var_value_gr.document);
	if(wf_activity_gr.get(wf_var_value_gr.document_key)) {
		if(wf_activity_gr.workflow_version){
			// Query for the workflow version
			var wf_version_gr = new GlideRecord("wf_workflow_version");
			wf_version_gr.addQuery("sys_id", wf_activity_gr.workflow_version);
			wf_version_gr.addQuery("published", true);
			wf_version_gr.query();
			if (wf_version_gr.next(wf_activity_gr.workflow_version)) {
				gs.print("Group is assigned to " + wf_version_gr.name + " -> " + wf_activity_gr.name);
			} else {
				//gs.print("WF version not published " + wf_activity_gr.workflow_version.getDisplayValue() + " -> " + wf_activity_gr.name);
			}
		} else {
			gs.print("Workflow activity version is blank for " + wf_activity_gr.name);
		}
	}
}

What's New

There are currently no new items, please check back later.

Archives
2021 (2)
  September (1)
  May (1)
2019 (1)
  August (1)
2018 (3)
  August (1)
  April (1)
  January (1)
2017 (1)
  January (1)
2016 (4)
  December (1)
  November (1)
  May (1)
  January (1)
2015 (1)
  December (1)
2014 (2)
  August (1)
  February (1)
2013 (4)
  October (1)
  July (1)
  June (1)
  April (1)
2012 (11)
  December (2)
  October (3)
  September (1)
  May (1)
  April (1)
  February (2)
  January (1)
2011 (14)
  December (1)
  November (1)
  September (2)
  July (2)
  June (1)
  May (1)
  April (2)
  March (3)
  January (1)
2009 (2)
  October (1)
  June (1)
2008 (1)
  September (1)